// Package _2___I__从上到下打印二叉树 main
// @Title _2___I__从上到下打印二叉树
// @Description
// @Author  == 琳琳也叫王木木 ==  2022-02-10 11:33
// @Create  2022-02-10 11:33
package main

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func levelOrder(root *TreeNode) []int {
	if root == nil {
		return nil
	}
	var ans []int
	myQue := []*TreeNode{root}
	for len(myQue) > 0 {
		t := myQue[0]
		myQue = myQue[1:]
		ans = append(ans, t.Val)
		if t.Left != nil {
			myQue = append(myQue, t.Left)
		}
		if t.Right != nil {
			myQue = append(myQue, t.Right)
		}
	}
	return ans
}

func main() {

}
